﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="Views.ViewDataModelEditor"
	d:DesignWidth="640" d:DesignHeight="480">

    <UserControl.Resources>
        <Style x:Key="visualPartThumb" TargetType="Thumb" >
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Thumb">
                        <Border Background="White" 
                                BorderBrush="Black" 
                                BorderThickness="5" 
                                CornerRadius="20"
                                Width="100"
                                Height="100"
                                
                                >
                            <Grid>
                            <TextBlock Text="Requete" HorizontalAlignment="Center" VerticalAlignment="Center" />
                     </Grid>   </Border>
                    </ControlTemplate>
                </Setter.Value> 
            </Setter>
        </Style> 
    </UserControl.Resources>
  
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Canvas Name="visualCnv" Background="Gray">
            <Canvas.ContextMenu>
                <ContextMenu >
                    <MenuItem Header="Ajouter une requete" Click="MenuItem_Click"  />
                    <MenuItem Header="Ajouter une table" Click="MenuItem_Click_1"  />
                </ContextMenu>
            </Canvas.ContextMenu>
        </Canvas>
        <TextBox Name="sqlTxt" AcceptsReturn="True"
                 AcceptsTab="True"
                 FontSize="20" 
                 FontStyle="Italic" 
                 FontWeight="Bold"
                 Margin="0,0,0,0" Text="{Binding QueryString, Mode=TwoWay}">
            <TextBox.Visibility>
                <Binding Path="IsChecked" ElementName="modeToggle">
                    <Binding.Converter>
                        <BooleanToVisibilityConverter />
                    </Binding.Converter>
                </Binding>
            </TextBox.Visibility>
        </TextBox>

        <GridSplitter Background="Black" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="3" ResizeBehavior="PreviousAndNext" />
        <UniformGrid Columns="3" Margin="0,3" Grid.Row="1">
            <Button Content="Executer"  Name="Button1"  />
            <Button Content="Generer"  Name="Button2"  />
            <ToggleButton Name="modeToggle" IsChecked="True" >
                <ToggleButton.Style>
                    <Style TargetType="ToggleButton">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsChecked}" Value="True">
                                <Setter Property="Content" Value="Mode Texte" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsChecked}" Value="False">
                                <Setter Property="Content" Value="Mode Schematique" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ToggleButton.Style>
            </ToggleButton>
        </UniformGrid>
        <GridSplitter Background="Black"  Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="3" ResizeBehavior="PreviousAndNext" />
        
        <DataGrid Grid.Row="2" Margin="0,0,0,0" Name="dgrid" AutoGenerateColumns="True" IsReadOnly="True" />
    </Grid>
</UserControl>